#ifndef BULLET_COMPONENT
#define BULLET_COMPONENT

#include "Base/Component.h"
#include "Base/Logger.h"
#include "MathUtiles.h"
#include <SFML/System.hpp>
#include <cstdlib>

struct Trajectoire
{
    virtual ~Trajectoire(){}
    virtual float getPath(float time)=0;// ta fonction float linePath(float time)
};

struct TrajectoireLine : Trajectoire
{
	float getPath(float time)
	{
		 return 0;
	 } 
};

struct TrajectoireLineRandom : Trajectoire
{
	TrajectoireLineRandom(float precision):Trajectoire(), mpv_random(getFloatRandom(-1,1)*precision)
	{
		 
	}
	float getPath(float time)
	{
		return mpv_random;
	} 
private:
	float mpv_random;
};

class BulletComponent : public BPL::Component
{
public:
	enum {NORMAL, GRENADE, ZONE};

	BulletComponent():timeElapsed(0),rebounds(0), trajectoire(new TrajectoireLine), verticalOrientation(1), 
					  horizontalOrientation(1), type(NORMAL), stop(false){}
	~BulletComponent()
	{
		delete trajectoire;
		trajectoire = NULL;
	}
	static const int familyId = 3;
	sf::Vector2f firstPosition;
	int IDlauncher;
	int rebounds;
	float power;

	sf::Vector2f direction;
	int verticalOrientation;
	int horizontalOrientation;
	float timeElapsed;

	int type;
	
	Trajectoire* trajectoire;

	// pour les grenades
	float range;
	float timeBeforeDeath;
	bool stop;


};

typedef boost::shared_ptr<BulletComponent> BulletComponentPtr;



#endif
